﻿<Page x:Name="page"
    x:Class="Microsoft.ALMRangers.VsarTreasureMap.WindowsStoreApp.Views.Snapped.Projects"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Microsoft.ALMRangers.VsarTreasureMap.WindowsStoreApp.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:converters="using:Microsoft.ALMRangers.VsarTreasureMap.WindowsStoreApp.Converters"      
    mc:Ignorable="d" Width="320">
    <Page.Resources>
        <converters:MaterialTypeMetaConverter x:Key="displayNameMaterialTypeMetaConverter" ReturnDisplayName="True"/>
        <converters:MaterialTypeMetaConverter x:Key="imageMaterialTypeMetaConverter" ReturnDisplayName="False"/>
    </Page.Resources>

    <FlipView Background="{StaticResource BackgroundBrush}" ItemsSource="{Binding ProjectCollection}" SelectedItem="{Binding SelectedProject,Mode=TwoWay}">
        <FlipView.ItemTemplate>
            <DataTemplate>
                <Grid Background="{StaticResource BackgroundBrush}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="80"/>
                        <RowDefinition Height="10"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="60"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Button Command="{Binding DataContext.GoBack, ElementName=page}" Grid.Column="0" Style="{StaticResource BackButtonStyle}" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center" />
                        <TextBlock Grid.Column="1" VerticalAlignment="Center" Style="{StaticResource SubheaderTextStyle}" Text="{Binding Name}" Margin="0" FontFamily="{StaticResource TitleFont}" Foreground="{StaticResource TitleBrush}" />
                    </Grid>
                    <ScrollViewer Grid.Row="2" HorizontalScrollMode="Disabled" ZoomMode="Disabled">
                        <Grid Margin="25,0,25,10">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="185"/>
                                <RowDefinition Height="5"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="5"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Image Grid.Row="0" Width="240" Source="{Binding Image}" VerticalAlignment="Top" />
                            <TextBlock Grid.Row="2" Text="{Binding Description}" TextWrapping="Wrap" Style="{StaticResource BodyTextStyle}" Foreground="{StaticResource ContentForegroundBrush}"/>
                            <ListBox Grid.Row="4" ItemsSource="{Binding Guidance}" Background="{x:Null}" BorderBrush="{x:Null}" ItemContainerStyle="{StaticResource ListBoxItemStyle}" Template="{StaticResource ListBoxControlTemplate}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <HyperlinkButton Grid.Row="2" CommandParameter="{Binding}" Command="{Binding ElementName=page, Path=DataContext.MarkGuidanceAsDone}" VerticalAlignment="Center" NavigateUri="{Binding Url}" Foreground="White" Style="{StaticResource HyperlinkButtonStyle}" Padding="0" RightTapped="HyperlinkButtonRightTapped">
                                            <TextBlock VerticalAlignment="Center">
                                            <Run Text="Find "/>
                                            <Run Text="{Binding GuidanceType, Converter={StaticResource displayNameMaterialTypeMetaConverter}}"/>
                                            <Run Text=" jewel here: "/>
                                            <LineBreak/>
                                            <Run Text="{Binding Url}"/>
                                            </TextBlock>
                                        </HyperlinkButton>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </ScrollViewer>
                </Grid>
            </DataTemplate>
        </FlipView.ItemTemplate>
    </FlipView>
</Page>